From 4376ebf4c518f9aa995abc288f28bc54b6b13150 Mon Sep 17 00:00:00 2001 From: parkrrrr Date: Wed, 27 Jul 2005 19:57:55 +0000 Subject: [PATCH] Possible but unobserved-in-the-wild bug where endpoints could get dropped. --- gpsbabel/smplrout.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/gpsbabel/smplrout.c b/gpsbabel/smplrout.c index da2145635..cfffe54ff 100644 --- a/gpsbabel/smplrout.c +++ b/gpsbabel/smplrout.c @@ -55,7 +55,7 @@ free_xte( struct xte *xte_rec ) xfree(xte_rec->intermed); } -#define HUGEVAL 9e9; +#define HUGEVAL 2000000000 static struct xte_intermed *tmpprev = NULL; static int xte_count = 0; @@ -112,6 +112,13 @@ compare_xte( const void *a, const void *b ) ((struct xte *)b)->distance; int priodiff = ((struct xte *)a)->intermed->wpt->route_priority - ((struct xte *)b)->intermed->wpt->route_priority; + + if (HUGEVAL == ((struct xte *)a)->distance) + return -1; + + if (HUGEVAL == ((struct xte *)b)->distance) + return 1; + if ( priodiff < 0 ) return 1; if ( priodiff > 0 ) return -1; if ( distdiff < 0 ) return 1; -- 2.30.2